package chapter3;
import java.util.Scanner;
public class season {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int i = input.nextInt();
        String j;
    if (i<=10&&i>=4) {
        j = input.next();
        if ("头等舱".equals(j)) {
            System.out.println(5000 * 0.9);
        } else if ("商务舱".equals(j)) {
            System.out.println(5000 * 0.8);
        } else if ("经济舱".equals(j)) {
            System.out.println(5000 * 0.7);
        }
    }else {
        j = input.next();
        if ("头等舱".equals(j)) {
            System.out.println(5000 * 0.9);
        } else if ("商务舱".equals(j)) {
            System.out.println(5000 * 0.8);
        } else if ("经济舱".equals(j)) {
            System.out.println(5000 * 0.7);
        }
    }
}
}
